package com.yzion.baselib.fragment

import android.view.Gravity
import android.view.WindowManager
import androidx.viewbinding.ViewBinding
import com.yzion.baselib.R

/**
 * Created by Alexis.Shelton on 5/7/2021.
 */
abstract class BaseBottomDialogFragment<VB : ViewBinding> : BaseDialogFragment<VB>() {

    override fun onStart() {
        super.onStart()
        dialog?.window?.let { window ->
            window.setGravity(Gravity.BOTTOM) //可设置dialog的位置
            window.decorView.setPadding(0, 0, 0, 0) //消除边距
            val lp = window.attributes
            lp.width = WindowManager.LayoutParams.MATCH_PARENT   //设置宽度充满屏幕
            lp.height = WindowManager.LayoutParams.WRAP_CONTENT
            window.attributes = lp
            window.setWindowAnimations(R.style.DialogBottomAnimation)
        }
    }
}